/*
 * Copyright 2011 Clean GWT
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.cleangwt.user.cellview.client;

import java.util.List;

import com.cleangwt.json.client.SimpleObject;
import com.google.gwt.cell.client.Cell;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.view.client.ProvidesKey;
import com.google.gwt.view.client.SelectionModel;

/**
 * @author Jess
 * @version 1.0
 * @since 1.0
 * @deprecated experimental
 */
public final class CellGrid extends com.google.gwt.user.cellview.client.CellList<SimpleObject> {

  /**
   * A ClientBundle that provides images for this widget.
   */
  interface Resources extends com.google.gwt.user.cellview.client.CellList.Resources {
    /**
     * The background used for selected items.
     */
    @ImageOptions(repeatStyle = RepeatStyle.Horizontal, flipRtl = true)
    ImageResource cellListSelectedBackground();

    /**
     * The styles used in this widget.
     */
    @Source("cellList.css")
    Style cellListStyle();
  }

  private static Resources RESOURCES = GWT.create(Resources.class);

  /**
   * @param cell
   */
  public CellGrid(Cell<SimpleObject> cell) {
    this(cell, null);
  }

  /**
   * @param cell
   * @param keyProvider
   */
  public CellGrid(Cell<SimpleObject> cell, ProvidesKey<SimpleObject> keyProvider) {
    super(cell, RESOURCES, keyProvider);
  }

  @Override
  protected void renderRowValues(SafeHtmlBuilder sb, List<SimpleObject> values, int start,
      SelectionModel<? super SimpleObject> selectionModel) {
    super.renderRowValues(sb, values, start, selectionModel);
  }

}
